//汽车车牌号，原价，折扣数
/*#include<iostream>
#include<string.h>
using namespace std;

class Car
{
public:
	char cph[15];
	float price;
public:
	void input(char a[15], float b)
	{
		strcpy(cph, a);
		price = b;
	}
	void change()
	{
		float k;
		cout<<"请输入折扣数：";
		cin>>k;
		price = price * k;
	}
	void output()
	{
		cout<<"车牌号："<<cph<<"  "<<"车价："<<price<<endl;
	}
};
int main()
{
	char a[15];
	float b;
	Car C1;
	cout<<"清输入车牌号：";
	cin.getline(a,15);
	cout<<"请输入原价：";
	cin>>b;
	C1.input(a,b);
	C1.change();
	C1.output();
	return 0;
}

//学生姓名，班级
#include<iostream>
#include<string.h>
using namespace std;

class Student
{
public:
	char xm[15];
	char bj[10];
public:
	void setName(char a[15])
	{
		strcpy(xm,a);
	}
	void setBj(char b[10])
	{
		strcpy(bj,b);
	}
	void output()
	{
		cout<<"姓名："<<xm<<"  "<<"班级："<<bj<<endl;
	}
};
int main()
{
	char a[15];
	char b[10];
	Student S1;
	cout<<"请输入学生姓名：";
	cin.getline(a,15);
	cout<<"请输入学生班级：";
	cin.getline(b,10);
	S1.setName(a);
	S1.setBj(b);
	S1.output();
	return 0;
}*/

//圆的半径，周长，面积
/*#include<iostream>
using namespace std;
#define PI 3.14

class circle
{
	double banjin;
	double C;
	double S;
public:
	circle(double b)
	{
		banjin = b;
		C = 2 * PI * banjin;
		S = PI * banjin * banjin;
	}
	void show()
	{
		cout<<"圆的半径："<<banjin<<"  "<<"圆的周长："<<C<<"  "<<"圆的面积："<<S<<endl;
	}
};

int main()
{
	circle c1(2.0);
	c1.show();
	return 0;
}*/

//创建学生成绩类，输出平均成绩
//第一种：普通构造
#include<iostream>
using namespace std;
#include<cstring>

/*class stu
{
	char num[10];
	char name[10];
	double Chinese;
	double math;
	double computer;
	double aver;
public:
	stu(char* n, char* m, double a, double b, double c)
	{
		strcpy(num, n);
		strcpy(name, m);
		Chinese = a;
		math = b;
		computer = c;
	}
	void output()
	{
		aver = (Chinese + math + computer) / 3;
		cout<<"该同学的平均成绩为："<<aver<<endl;
	}
};

int main()
{
	stu s1("000001", "张三", 89.0, 92.0, 89.0);
	s1.output();
	return 0;
}*/

//第二种：参数带默认值的构造
/*class stu
{
	char num[10];
	char name[10];
	double Chinese;
	double math;
	double computer;
	double aver;
public:
	stu(double a, double b, double c, char* n = "000002", char* m = "李四")
	{
		Chinese = a;
		math = b;
		computer = c;
	}
	void output()
	{
		aver = (Chinese + math + computer) / 3;
		cout<<"该同学的平均成绩为："<<aver<<endl;
	}
};

int main()
{
	stu s2(88.5, 97.5, 89.0);
	s2.output();
	return 0;
}*/

//第三种：重载构造函数
/*class stu
{
	char num[10];
	char name[10];
	double Chinese;
	double math;
	double computer;
	double aver;
public:
	stu(char* n, char* m, double a, double b, double c)
	{
		strcpy(num, n);
		strcpy(name, m);
		Chinese = a;
		math = b;
		computer = c;
	}
	stu(double a, double b, double c, char* n = "000002", char* m = "小明")
	{
		Chinese = a;
		math = b;
		computer = c;
	}
	void output()
	{
		aver = (Chinese + math + computer) / 3;
		cout<<"该同学的平均成绩为："<<aver<<endl;
	}
};

int main()
{
	stu s1("000001", "小美", 89.0, 91.0, 93.0);
	s1.output();
	stu s2(88.5, 97.5, 89.0);
	s2.output();
	return 0;
}*/


//求圆柱体的体积
/*#define PI 3.14
class cyl
{
	float r;
	float h;
	float v;
public:
	cyl(float a, float b)
	{
		r = a;
		h = b;
		v = PI * r * r * h;
		cout<<"圆柱的体积为："<<v<<endl;
	}
	~cyl()
	{
		cout<<"调用析构"<<endl;
	}
};

int main()
{
	cyl c1(2.0, 7.0);
	cyl c2(3.0, 9.0);
	return 0;
}*/
